package com.exam.meituan;

import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution102 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        int zeros = 0;
        int[] leftOnes = new int[n + 1];
        int[] rightMinusOnes = new int[n + 1];
        for (int i = 0; i < n; i++) {
            if(nums[i] == 0) {
                zeros++;
            }
            if(nums[i] == 1) {
                leftOnes[i + 1] = leftOnes[i] + 1;
            } else {
                leftOnes[i + 1] = leftOnes[i];
            }
        }
        for (int i = n - 1; i >= 0; i--) {
            if(nums[i] == -1) {
                rightMinusOnes[i] = rightMinusOnes[i + 1] + 1;
            } else {
                rightMinusOnes[i] = rightMinusOnes[i + 1];
            }
        }
        int res = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            res = Math.min(res, leftOnes[i] + rightMinusOnes[i]);
        }
        res += zeros;
        System.out.println(res);
    }
}
